/***********************************
 * xx_list.jsp common js
 * @author shieh
 * @date 2012/06/28 8:27 
 * @version 1.0 
 * @version 1.1 增加newJump函数 2012/06/28 8:27
 ***********************************/
var flag=true;
//无复选框"全选"
function newCheckAll(name){
var coll = document.getElementsByName(name);

		if(flag){
		for(var i=0;i<coll.length;i++){
		coll[i].checked=true;
		}
		flag=false;
		}
		else{
		for(var i=0;i<coll.length;i++){
		coll[i].checked=false;
		}
		flag=true;
		}
}
 //全部选中
function CheckAll(name)
{
	var coll = document.getElementsByName(name);
	var ca = document.getElementById("chkall");
	for(var i=0;i<coll.length;i++)
	{
		if(ca.checked)
		coll[i].checked=true;
		else
		coll[i].checked=false;
	}
}
function fSetBg(obj){
	obj.style.backgroundColor = '#f0f0f0';
}
function fReBg(obj){
	var objChildCheck = document.all ? obj.children[0].children[0] : obj.childNodes[1].childNodes[1];
	if(objChildCheck.checked){
		return false;
	}
	obj.style.backgroundColor = '';
}
//批量操作前检测是否选中对象
function checkSel(theForm){
	if(selectSomeone(theForm))
	{
		return confirm("确认操作?");
	}
	else
	{
		alert( "请勾选对象后再操作！");
		return false;
	}
}

//批量操作前检测是否选中对象
function newCheckSel(theForm){
	if(selectSomeone(theForm))
	{
		return true;
	}
	else
	{
		alert( "请勾选对象后再操作！");
		return false;
	}
}

//发送消息批量操作前检测是否选中对象2012-07-02 0:21
function checkSel4Msg(theForm){
	if(selectSomeone(theForm))
	{
		return true;
	}
	else
	{
		alert("请选择消息接收人！");
		return false;
	}
}
function selectSomeone(theForm)
{
	
	for (var i=0; i<theForm.elements.length; i++)
	{
		var e = theForm.elements[i];
		if ( e.checked )
			return true;		
	}	
	return false;
}

/**
 *新跳转检测函数 
 *ver1.0 2012-06-28 
 */
function newJump(objId,totalPage,pageName,pageSize){
try{
var obj=document.getElementById(objId);
var nJumpPage=obj.value;
if(!isNaN(nJumpPage)&&nJumpPage>0){
  if(nJumpPage<=totalPage){
     var url=pageName+"?index="+(nJumpPage-1)+"&pageSize="+pageSize;
     window.location.href=url;
  }else{
    alert('跳转页数不能大于总页数');
  }
}else{
alert('请输入正确的数字后跳转');
}
}catch(e){}
}